<?php

require_once 'core/model/module.php';

class Core_Model_Table_Module extends Nuo_Db_Table
{

    /**
     * module table name
     * @property string
     */
    protected $_name = 'core_modules';

    /**
     * Module model class
     * @property string
     */
    protected $_rowClass = 'Core_Model_Module';

    /**
     * fetch to array of object
     * @return array
     */
    public function getAsOptions()
    {
        $select = $this -> select() -> where('type=?', 'module') -> order('priority');

        $result = array();

        foreach ($this->fetchAll($select) as $row)
        {
            $result[$row -> getId()] = $row -> getTitle();
        }

        return $result;
    }

}
